import axios from "axios";
import *as constants from "./constants";

const changeHomeData = (result) => ({
    type: constants.CHANGE_HOME_DATA,
    topicList: result.data.data.topicList,
    articleList: result.data.data.articleList,
    recommendList: result.data.data.recommendList
})

export const getHomeInfo = () => {
    return (dispatch) => {
        axios.get('/api/home.json').then((result) => {
            console.log(result.data.data);
            dispatch(changeHomeData(result))
        })
    }
}